package com.asset.inventory.network

import android.util.Log
import com.asset.inventory.kt.logE
import io.reactivex.Observer
import io.reactivex.disposables.Disposable

/**
 *    @author : sibb
 *    date   : 21-4-7
 *    desc   :
 */
interface RequestObserver<T>: Observer<T>{


    override fun onComplete() {

    }

    override fun onSubscribe(d: Disposable) {

    }

    override fun onNext(t: T) {
        onSuccess(t)
    }

    override fun onError(e: Throwable) {
        "请求失败，错误信息：\n${e.message}".logE()
        onFaile(e)
    }

    fun onSuccess(t: T)

    fun onFaile(e: Throwable)
}